package com.yx.system.dao;

import com.yx.common.utils.Query;
import com.yx.system.entity.TdBook;
import com.yx.system.entity.TdCollection;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 收藏
 */
@Mapper
@Repository
public interface TdCollectionMapper {

    int deleteByPrimaryKey(Integer id);

    int insert(TdCollection record);

    int insertSelective(TdCollection record);

    TdCollection selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TdCollection record);

    int updateByPrimaryKey(TdCollection record);

    /**
     * 查询收藏列表
     */
    List<TdCollection> queryList(Map<String, Object> map);

    /**
     * 查询总数
     */
    int queryTotal(Map<String, Object> map);

    /**
     * 按书籍iD和用户ID查询列表
     */
    List<TdCollection> isCollection(Map<String, Object> map);

    TdCollection findByBookidAndUserUUIDAnddelete(@Param("uid") String uid, @Param("bookid") Integer bookid);

    TdCollection findByBookidAndUserUUIDAndExist(@Param("uid") String uid, @Param("bookid") Integer bookid);


    void updateByDeleteOperate(Integer id);

    List<TdCollection> queryList1(Query query);

    int queryTotal1(Query query);

    Integer findTotalByUseruuid(String uuid);

    TdCollection findByUserAndBook(@Param("uid") String uuid, @Param("bookid") Integer bookid);
}